
clc 
close all
clear all
sample_size = 2000;
coefficient = 8/6;
MEAN = 0;
SIQR = 1;
if (MEAN == 1)
  %%PRKS
  prks95_delayslot = LinkMeanDelay('prks95_delayslot_type2.txt',sample_size);
  prks95_delayslot = sort(prks95_delayslot);
  prks90_delayslot = LinkMeanDelay('prks90_delayslot_type2.txt',sample_size);
  prks90_delayslot = sort(prks90_delayslot);
  prks80_delayslot = LinkMeanDelay('prks80_delayslot_type2.txt',sample_size);
  prks80_delayslot = sort(prks80_delayslot);
  prks70_delayslot = LinkMeanDelay('prks70_delayslot_type2.txt',sample_size);
  prks70_delayslot = sort(prks70_delayslot);
  prks60_delayslot = LinkMeanDelay('prks60_delayslot_type2.txt',sample_size);
  prks60_delayslot = sort(prks60_delayslot);
  prks50_delayslot = LinkMeanDelay('prks50_delayslot_type2.txt',sample_size);
  prks50_delayslot = sort(prks50_delayslot);
  prks40_delayslot = LinkMeanDelay('prks40_delayslot_type2.txt',sample_size);
  prks40_delayslot = sort(prks40_delayslot);
  prks30_delayslot = LinkMeanDelay('prks30_delayslot_type2.txt',sample_size);
  prks30_delayslot = sort(prks30_delayslot);
  %%RID
  rid95_delayslot = LinkMeanDelay('rid95_delayslot_type2.txt',sample_size);
  rid95_delayslot = sort(rid95_delayslot);
  rid90_delayslot = LinkMeanDelay('rid90_delayslot_type2.txt',sample_size);
  rid90_delayslot = sort(rid90_delayslot);
  rid80_delayslot = LinkMeanDelay('rid80_delayslot_type2.txt',sample_size);
  rid80_delayslot = sort(rid80_delayslot);
  rid70_delayslot = LinkMeanDelay('rid70_delayslot_type2.txt',sample_size);
  rid70_delayslot = sort(rid70_delayslot);
  %%B-MAC
  csma_delayslot = LinkMeanDelay('csma_delayslot_type2.txt',sample_size);
  csma_delayslot = sort(csma_delayslot*coefficient);
  %%S-MAC
  rtscts_delayslot = LinkMeanDelay('rtscts_delayslot_type2.txt',sample_size);
  rtscts_delayslot = sort(rtscts_delayslot*coefficient);
  %%CMAC
  cmac95_delayslot = LinkMeanDelay('cmac95_delayslot_type2.txt',sample_size);
  cmac95_delayslot = sort(cmac95_delayslot*coefficient);
  cmac90_delayslot = LinkMeanDelay('cmac90_delayslot_type2.txt',sample_size);
  cmac90_delayslot = sort(cmac90_delayslot*coefficient);
  cmac80_delayslot = LinkMeanDelay('cmac80_delayslot_type2.txt',sample_size);
  cmac80_delayslot = sort(cmac80_delayslot*coefficient);
  cmac70_delayslot = LinkMeanDelay('cmac70_delayslot_type2.txt',sample_size);
  cmac70_delayslot = sort(cmac70_delayslot*coefficient);
  %%SCREAM
  scream_delayslot = LinkMeanDelay('scream_delayslot_type2.txt',sample_size);
  scream_delayslot = sort(scream_delayslot);


  CSMA_mean_diff = [];
  for i=1:length(csma_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == csma_delayslot(i,1)/coefficient
            CSMA_mean_diff = [CSMA_mean_diff;  csma_delayslot(i,1)/coefficient csma_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

RTSCTS_mean_diff = [];
for i=1:length(rtscts_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == rtscts_delayslot(i,1)/coefficient
            RTSCTS_mean_diff = [RTSCTS_mean_diff;  rtscts_delayslot(i,1)/coefficient rtscts_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

SCREAM_mean_diff = [];
for i=1:length(scream_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == scream_delayslot(i,1)
            SCREAM_mean_diff = [SCREAM_mean_diff;  scream_delayslot(i,1) scream_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

RID_mean_diff70 = [];
for i=1:length(rid70_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == rid70_delayslot(i,1)
            RID_mean_diff70 = [RID_mean_diff70;  rid70_delayslot(i,1) rid70_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

RID_mean_diff80 = [];
for i=1:length(rid80_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == rid80_delayslot(i,1)
            RID_mean_diff80 = [RID_mean_diff80;  rid80_delayslot(i,1) rid80_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

RID_mean_diff90 = [];
for i=1:length(rid90_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == rid90_delayslot(i,1)
            RID_mean_diff90 = [RID_mean_diff90;  rid90_delayslot(i,1) rid90_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

RID_mean_diff95 = [];
for i=1:length(rid95_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == rid95_delayslot(i,1)
            RID_mean_diff95 = [RID_mean_diff95;  rid95_delayslot(i,1) rid95_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

CMAC_mean_diff70 = [];
for i=1:length(cmac70_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == cmac70_delayslot(i,1)/coefficient
            CMAC_mean_diff70 = [CMAC_mean_diff70;  cmac70_delayslot(i,1)/coefficient cmac70_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

CMAC_mean_diff80 = [];
for i=1:length(cmac80_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == cmac80_delayslot(i,1)/coefficient
            CMAC_mean_diff80 = [CMAC_mean_diff80;  cmac80_delayslot(i,1)/coefficient cmac80_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

CMAC_mean_diff90 = [];
for i=1:length(cmac90_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == cmac90_delayslot(i,1)/coefficient
            CMAC_mean_diff90 = [CMAC_mean_diff90;  cmac90_delayslot(i,1)/coefficient cmac90_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

CMAC_mean_diff95 = [];
for i=1:length(cmac95_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == cmac95_delayslot(i,1)/coefficient
            CMAC_mean_diff95 = [CMAC_mean_diff95;  cmac95_delayslot(i,1)/coefficient cmac95_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

PRKS_mean_diff95 = [];
for i=1:length(prks95_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == prks95_delayslot(i,1)
            PRKS_mean_diff95 = [PRKS_mean_diff95;  prks95_delayslot(i,1) prks95_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

PRKS_mean_diff80 = [];
for i=1:length(prks80_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == prks80_delayslot(i,1)
            PRKS_mean_diff80 = [PRKS_mean_diff80;  prks80_delayslot(i,1) prks80_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

PRKS_mean_diff70 = [];
for i=1:length(prks70_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == prks70_delayslot(i,1)
            PRKS_mean_diff70 = [PRKS_mean_diff70;  prks70_delayslot(i,1) prks70_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end
PRKS_mean_diff60 = [];
for i=1:length(prks60_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == prks60_delayslot(i,1)
            PRKS_mean_diff60 = [PRKS_mean_diff60;  prks60_delayslot(i,1) prks60_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end
PRKS_mean_diff50 = [];
for i=1:length(prks50_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == prks50_delayslot(i,1)
            PRKS_mean_diff50 = [PRKS_mean_diff50;  prks50_delayslot(i,1) prks50_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end
PRKS_mean_diff40 = [];
for i=1:length(prks40_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == prks40_delayslot(i,1)
            PRKS_mean_diff40 = [PRKS_mean_diff40;  prks40_delayslot(i,1) prks40_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end
PRKS_mean_diff30 = [];
for i=1:length(prks30_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == prks30_delayslot(i,1)
            PRKS_mean_diff30 = [PRKS_mean_diff30;  prks30_delayslot(i,1) prks30_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

ARR=PRKS_mean_diff95(:,2);
h1 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h1,'color','r','Marker','*');
ARR=PRKS_mean_diff80(:,2);
h2 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h2,'color','r','Marker','o');
ARR=PRKS_mean_diff70(:,2);
h3 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h3,'color','r','Marker','x');
ARR=PRKS_mean_diff60(:,2);
h_prks60 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h_prks60,'color','r','Marker','.');
ARR=PRKS_mean_diff50(:,2);
h_prks50 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h_prks50,'color','r','Marker','s');
ARR=PRKS_mean_diff40(:,2);
h_prks40 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h_prks40,'color','r','Marker','d');
ARR=PRKS_mean_diff30(:,2);
h_prks30 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h_prks30,'color','r','Marker','^');

ARR=RID_mean_diff95(:,2);
h4 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h4,'color','c','Marker','*');
ARR=RID_mean_diff90(:,2);
h5 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h5,'color','c','Marker','+');
ARR=RID_mean_diff80(:,2);
h6 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h6,'color','c','Marker','o');
ARR=RID_mean_diff70(:,2);
h7 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h7,'color','c','Marker','x');

ARR=CMAC_mean_diff95(:,2);
h8 = cdfplot (sign(ARR).*log(abs(ARR)));
set(h8,'color','b','Marker','*');
hold on;
ARR=CMAC_mean_diff90(:,2);
h9 = cdfplot (sign(ARR).*log(abs(ARR)));
set(h9,'color','b','Marker','+');
hold on;
ARR=CMAC_mean_diff80(:,2);
h10 = cdfplot (sign(ARR).*log(abs(ARR)));
set(h10,'color','b','Marker','o');
hold on;
ARR=CMAC_mean_diff70(:,2);
h11 = cdfplot (sign(ARR).*log(abs(ARR)));
set(h11,'color','b','Marker','x');
hold on;

ARR=CSMA_mean_diff(:,2);
h12 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h12,'color','m');

ARR=RTSCTS_mean_diff(:,2);
h13 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h13,'color','k');

ARR=SCREAM_mean_diff(:,2);
h14 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h14,'color','g');

title('');
ylabel('CDF');
xlabel('Sign \times log (link delay mean difference), PRKS 90% as base line');
legend('RPKS95','RPKS80','RPKS70','RPKS60','RPKS50','RPKS40','RPKS30','RIDB95','RIDB90','RIDB80','RIDB70','CMAC95','CMAC90','CMAC80','CMAC70','CSMA','RTSCTS','SCREAM');
%rcmkb
end
if (SIQR == 1)
  %%PRKS
  prks95_delayslot = LinkSiqrDelay('prks95_delayslot_type2.txt',sample_size);
  prks95_delayslot = sort(prks95_delayslot);
  prks90_delayslot = LinkSiqrDelay('prks90_delayslot_type2.txt',sample_size);
  prks90_delayslot = sort(prks90_delayslot);
  prks80_delayslot = LinkSiqrDelay('prks80_delayslot_type2.txt',sample_size);
  prks80_delayslot = sort(prks80_delayslot);
  prks70_delayslot = LinkSiqrDelay('prks70_delayslot_type2.txt',sample_size);
  prks70_delayslot = sort(prks70_delayslot);
  prks60_delayslot = LinkSiqrDelay('prks60_delayslot_type2.txt',sample_size);
  prks60_delayslot = sort(prks60_delayslot);
  prks50_delayslot = LinkSiqrDelay('prks50_delayslot_type2.txt',sample_size);
  prks50_delayslot = sort(prks50_delayslot);
  prks40_delayslot = LinkSiqrDelay('prks40_delayslot_type2.txt',sample_size);
  prks40_delayslot = sort(prks40_delayslot);
  prks30_delayslot = LinkSiqrDelay('prks30_delayslot_type2.txt',sample_size);
  prks30_delayslot = sort(prks30_delayslot);
  %%RID
  rid95_delayslot = LinkSiqrDelay('rid95_delayslot_type2.txt',sample_size);
  rid95_delayslot = sort(rid95_delayslot);
  rid90_delayslot = LinkSiqrDelay('rid90_delayslot_type2.txt',sample_size);
  rid90_delayslot = sort(rid90_delayslot);
  rid80_delayslot = LinkSiqrDelay('rid80_delayslot_type2.txt',sample_size);
  rid80_delayslot = sort(rid80_delayslot);
  rid70_delayslot = LinkSiqrDelay('rid70_delayslot_type2.txt',sample_size);
  rid70_delayslot = sort(rid70_delayslot);
  %%B-MAC
  csma_delayslot = LinkSiqrDelay('csma_delayslot_type2.txt',sample_size);
  csma_delayslot = sort(csma_delayslot*coefficient);
  %%S-MAC
  rtscts_delayslot = LinkSiqrDelay('rtscts_delayslot_type2.txt',sample_size);
  rtscts_delayslot = sort(rtscts_delayslot*coefficient);
  %%CMAC
  cmac95_delayslot = LinkSiqrDelay('cmac95_delayslot_type2.txt',sample_size);
  cmac95_delayslot = sort(cmac95_delayslot*coefficient);
  cmac90_delayslot = LinkSiqrDelay('cmac90_delayslot_type2.txt',sample_size);
  cmac90_delayslot = sort(cmac90_delayslot*coefficient);
  cmac80_delayslot = LinkSiqrDelay('cmac80_delayslot_type2.txt',sample_size);
  cmac80_delayslot = sort(cmac80_delayslot*coefficient);
  cmac70_delayslot = LinkSiqrDelay('cmac70_delayslot_type2.txt',sample_size);
  cmac70_delayslot = sort(cmac70_delayslot*coefficient);
  %%SCREAM
  scream_delayslot = LinkSiqrDelay('scream_delayslot_type2.txt',sample_size);
  scream_delayslot = sort(scream_delayslot);


  CSMA_siqr_diff = [];
  for i=1:length(csma_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == csma_delayslot(i,1)/coefficient
            CSMA_siqr_diff = [CSMA_siqr_diff;  csma_delayslot(i,1)/coefficient csma_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

RTSCTS_siqr_diff = [];
for i=1:length(rtscts_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == rtscts_delayslot(i,1)/coefficient
            RTSCTS_siqr_diff = [RTSCTS_siqr_diff;  rtscts_delayslot(i,1)/coefficient rtscts_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

SCREAM_siqr_diff = [];
for i=1:length(scream_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == scream_delayslot(i,1)
            SCREAM_siqr_diff = [SCREAM_siqr_diff;  scream_delayslot(i,1) scream_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

RID_siqr_diff70 = [];
for i=1:length(rid70_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == rid70_delayslot(i,1)
            RID_siqr_diff70 = [RID_siqr_diff70;  rid70_delayslot(i,1) rid70_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

RID_siqr_diff80 = [];
for i=1:length(rid80_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == rid80_delayslot(i,1)
            RID_siqr_diff80 = [RID_siqr_diff80;  rid80_delayslot(i,1) rid80_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

RID_siqr_diff90 = [];
for i=1:length(rid90_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == rid90_delayslot(i,1)
            RID_siqr_diff90 = [RID_siqr_diff90;  rid90_delayslot(i,1) rid90_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

RID_siqr_diff95 = [];
for i=1:length(rid95_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == rid95_delayslot(i,1)
            RID_siqr_diff95 = [RID_siqr_diff95;  rid95_delayslot(i,1) rid95_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

CMAC_siqr_diff70 = [];
for i=1:length(cmac70_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == cmac70_delayslot(i,1)/coefficient
            CMAC_siqr_diff70 = [CMAC_siqr_diff70;  cmac70_delayslot(i,1)/coefficient cmac70_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

CMAC_siqr_diff80 = [];
for i=1:length(cmac80_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == cmac80_delayslot(i,1)/coefficient
            CMAC_siqr_diff80 = [CMAC_siqr_diff80;  cmac80_delayslot(i,1)/coefficient cmac80_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

CMAC_siqr_diff90 = [];
for i=1:length(cmac90_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == cmac90_delayslot(i,1)/coefficient
            CMAC_siqr_diff90 = [CMAC_siqr_diff90;  cmac90_delayslot(i,1)/coefficient cmac90_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

CMAC_siqr_diff95 = [];
for i=1:length(cmac95_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == cmac95_delayslot(i,1)/coefficient
            CMAC_siqr_diff95 = [CMAC_siqr_diff95;  cmac95_delayslot(i,1)/coefficient cmac95_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

PRKS_siqr_diff95 = [];
for i=1:length(prks95_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == prks95_delayslot(i,1)
            PRKS_siqr_diff95 = [PRKS_siqr_diff95;  prks95_delayslot(i,1) prks95_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

PRKS_siqr_diff80 = [];
for i=1:length(prks80_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == prks80_delayslot(i,1)
            PRKS_siqr_diff80 = [PRKS_siqr_diff80;  prks80_delayslot(i,1) prks80_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

PRKS_siqr_diff70 = [];
for i=1:length(prks70_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == prks70_delayslot(i,1)
            PRKS_siqr_diff70 = [PRKS_siqr_diff70;  prks70_delayslot(i,1) prks70_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end
PRKS_siqr_diff60 = [];
for i=1:length(prks60_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == prks60_delayslot(i,1)
            PRKS_siqr_diff60 = [PRKS_siqr_diff60;  prks60_delayslot(i,1) prks60_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end
PRKS_siqr_diff50 = [];
for i=1:length(prks50_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == prks50_delayslot(i,1)
            PRKS_siqr_diff50 = [PRKS_siqr_diff50;  prks50_delayslot(i,1) prks50_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end
PRKS_siqr_diff40 = [];
for i=1:length(prks40_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == prks40_delayslot(i,1)
            PRKS_siqr_diff40 = [PRKS_siqr_diff40;  prks40_delayslot(i,1) prks40_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end
PRKS_siqr_diff30 = [];
for i=1:length(prks30_delayslot)
    for j = 1:length (prks90_delayslot)
        if prks90_delayslot(j,1) == prks30_delayslot(i,1)
            PRKS_siqr_diff30 = [PRKS_siqr_diff30;  prks30_delayslot(i,1) prks30_delayslot(i,2)-prks90_delayslot(j,2)];
        end
    end
end

ARR=PRKS_siqr_diff95(:,2);
h1 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h1,'color','r','Marker','*');
ARR=PRKS_siqr_diff80(:,2);
h2 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h2,'color','r','Marker','o');
ARR=PRKS_siqr_diff70(:,2);
h3 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h3,'color','r','Marker','x');
ARR=PRKS_siqr_diff60(:,2);
h_prks60 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h_prks60,'color','r','Marker','.');
ARR=PRKS_siqr_diff50(:,2);
h_prks50 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h_prks50,'color','r','Marker','s');
ARR=PRKS_siqr_diff40(:,2);
h_prks40 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h_prks40,'color','r','Marker','d');
ARR=PRKS_siqr_diff30(:,2);
h_prks30 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h_prks30,'color','r','Marker','^');

ARR=RID_siqr_diff95(:,2);
h4 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h4,'color','c','Marker','*');
ARR=RID_siqr_diff90(:,2);
h5 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h5,'color','c','Marker','+');
ARR=RID_siqr_diff80(:,2);
h6 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h6,'color','c','Marker','o');
ARR=RID_siqr_diff70(:,2);
h7 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h7,'color','c','Marker','x');

ARR=CMAC_siqr_diff95(:,2);
h8 = cdfplot (sign(ARR).*log(abs(ARR)));
set(h8,'color','b','Marker','*');
hold on;
ARR=CMAC_siqr_diff90(:,2);
h9 = cdfplot (sign(ARR).*log(abs(ARR)));
set(h9,'color','b','Marker','+');
hold on;
ARR=CMAC_siqr_diff80(:,2);
h10 = cdfplot (sign(ARR).*log(abs(ARR)));
set(h10,'color','b','Marker','o');
hold on;
ARR=CMAC_siqr_diff70(:,2);
h11 = cdfplot (sign(ARR).*log(abs(ARR)));
set(h11,'color','b','Marker','x');
hold on;

ARR=CSMA_siqr_diff(:,2);
h12 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h12,'color','m');

ARR=RTSCTS_siqr_diff(:,2);
h13 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h13,'color','k');

ARR=SCREAM_siqr_diff(:,2);
h14 = cdfplot (sign(ARR).*log(abs(ARR)));
hold on;
set(h14,'color','g');

title('');
ylabel('CDF');
xlabel('Sign \times log (link delay siqr difference), PRKS 90% as base line');
legend('RPKS95','RPKS80','RPKS70','RPKS60','RPKS50','RPKS40','RPKS30','RIDB95','RIDB90','RIDB80','RIDB70','CMAC95','CMAC90','CMAC80','CMAC70','CSMA','RTSCTS','SCREAM');
%rcmkb
end
